#ifndef INCLUDED_CURVE_EVALUATOR_H
#define INCLUDED_CURVE_EVALUATOR_H

#pragma warning(disable : 4786)

#include "Curve.h"
#include "vec.h"
#include "mat.h"

//using namespace std;

class CurveEvaluator
{
public:
	virtual ~CurveEvaluator(void);
	virtual void evaluateCurve(const std::vector<Point>& control_points, 
							   std::vector<Point>& evaluated_curve_points, 
							   const float& animation_length, 
							   const bool& wrap_control_points) const = 0;
	static float s_fFlatnessEpsilon;
	static int s_iSegCount;

protected:

	vector<Point> evaluateSpline(Mat4<double> basis, Vec4<double> ctrl_x, Vec4<double> ctrl_y, double sample_period) const;

	// Evaluate point at a given parameter
	double evaluatePoint(double u, double u3_coeff, double u2_coeff, double u1_coeff, double u0_coeff) const;
	double evaluatePoint(double u, Vec4<double> coeffs) const;

	// Ensure t is monotonically increasing with u - points must already be registered in increasing u
	vector<Point> trimPoints(vector<Point> points) const;

};


#endif